
package tcc.ejb.autenticador.entidade;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 *
 * @author Maciel
 */
@Entity
@Table(name = "profissional", catalog = "macielqs", schema = "autenticacao", uniqueConstraints = {
    @UniqueConstraint(columnNames = {"email"}),
    @UniqueConstraint(columnNames = {"login"}),
    @UniqueConstraint(columnNames = {"cpf"}),
    @UniqueConstraint(columnNames = {"rg"})})
@NamedQueries({
    @NamedQuery(name = "Profissional.findAll", query = "SELECT p FROM Profissional p"),
    @NamedQuery(name = "Profissional.findById", query = "SELECT p FROM Profissional p WHERE p.id = :id"),
    @NamedQuery(name = "Profissional.findByNome", query = "SELECT p FROM Profissional p WHERE p.nome = :nome"),
    @NamedQuery(name = "Profissional.findByRg", query = "SELECT p FROM Profissional p WHERE p.rg = :rg"),
    @NamedQuery(name = "Profissional.findByCpf", query = "SELECT p FROM Profissional p WHERE p.cpf = :cpf"),
    @NamedQuery(name = "Profissional.findByTelefoneRes", query = "SELECT p FROM Profissional p WHERE p.telefoneRes = :telefoneRes"),
    @NamedQuery(name = "Profissional.findByCelular", query = "SELECT p FROM Profissional p WHERE p.celular = :celular"),
    @NamedQuery(name = "Profissional.findByTelefoneCom", query = "SELECT p FROM Profissional p WHERE p.telefoneCom = :telefoneCom"),
    @NamedQuery(name = "Profissional.findByRamal", query = "SELECT p FROM Profissional p WHERE p.ramal = :ramal"),
    @NamedQuery(name = "Profissional.findByEmail", query = "SELECT p FROM Profissional p WHERE p.email = :email"),
    @NamedQuery(name = "Profissional.findByLogin", query = "SELECT p FROM Profissional p WHERE p.login = :login"),
    @NamedQuery(name = "Profissional.findBySenha", query = "SELECT p FROM Profissional p WHERE p.senha = :senha"),
    @NamedQuery(name = "Profissional.findBySkin", query = "SELECT p FROM Profissional p WHERE p.skin = :skin"),
    @NamedQuery(name = "Profissional.findByStatus", query = "SELECT p FROM Profissional p WHERE p.status = :status")})
public class Profissional implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id", nullable = false)
    private Integer id;
    @Basic(optional = false)
    @Column(name = "nome", nullable = false, length = 2147483647)
    private String nome;
    @Basic(optional = false)
    @Column(name = "rg", nullable = false, length = 45)
    private String rg;
    @Basic(optional = false)
    @Column(name = "cpf", nullable = false, length = 45)
    private String cpf;
    @Column(name = "telefone_res", length = 45)
    private String telefoneRes;
    @Column(name = "celular", length = 45)
    private String celular;
    @Column(name = "telefone_com", length = 45)
    private String telefoneCom;
    @Column(name = "ramal", length = 10)
    private String ramal;
    @Basic(optional = false)
    @Column(name = "email", nullable = false, length = 45)
    private String email;
    @Basic(optional = false)
    @Column(name = "login", nullable = false, length = 45)
    private String login;
    @Basic(optional = false)
    @Column(name = "senha", nullable = false, length = 45)
    private String senha;
    @Column(name = "skin", length = 45)
    private String skin;
    
    @Basic(optional = false)
    @Column(name = "status", nullable = false, length = 8)
    private String status;
    
    @Basic(optional = false)
    @Column(name = "funcao", nullable = false, length = 45)
    private String funcao;
    
    @JoinColumn(name = "unidade_id", referencedColumnName = "id", nullable = false)
    @ManyToOne(optional = false)
    private Unidade unidade;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "profissional")
    private List<Aplicacao> aplicacaoList;

    public Profissional() {
    }

    public Profissional(Integer id) {
        this.id = id;
    }

    public Profissional(Integer id, String nome, String rg, String cpf, String email, String login, String senha, String status) {
        this.id = id;
        this.nome = nome;
        this.rg = rg;
        this.cpf = cpf;
        this.email = email;
        this.login = login;
        this.senha = senha;
        this.status = status;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

    public String getRg() {
        return rg;
    }

    public void setRg(String rg) {
        this.rg = rg;
    }

    public String getCpf() {
        return cpf;
    }

    public void setCpf(String cpf) {
        this.cpf = cpf;
    }

    public String getTelefoneRes() {
        return telefoneRes;
    }

    public void setTelefoneRes(String telefoneRes) {
        this.telefoneRes = telefoneRes;
    }

    public String getCelular() {
        return celular;
    }

    public void setCelular(String celular) {
        this.celular = celular;
    }

    public String getTelefoneCom() {
        return telefoneCom;
    }

    public void setTelefoneCom(String telefoneCom) {
        this.telefoneCom = telefoneCom;
    }

    public String getRamal() {
        return ramal;
    }

    public void setRamal(String ramal) {
        this.ramal = ramal;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getLogin() {
        return login;
    }

    public void setLogin(String login) {
        this.login = login;
    }

    public String getSenha() {
        return senha;
    }

    public void setSenha(String senha) {
        this.senha = senha;
    }

    public String getSkin() {
        return skin;
    }

    public void setSkin(String skin) {
        this.skin = skin;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Unidade getUnidade() {
        return unidade;
    }

    public void setUnidade(Unidade unidade) {
        this.unidade = unidade;
    }


    public List<Aplicacao> getAplicacaoList() {
        return aplicacaoList;
    }

    public void setAplicacaoList(List<Aplicacao> aplicacaoList) {
        this.aplicacaoList = aplicacaoList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Profissional)) {
            return false;
        }
        Profissional other = (Profissional) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "tcc.ejb.autenticador.entidade.Profissional[id=" + id + "]";
    }

	public void setFuncao(String funcao) {
		this.funcao = funcao;
	}

	public String getFuncao() {
		return funcao;
	}

}

